export default {
  StoreAttendanceType: {
    entity: { name: 'AttendanceType', prefix: () => `store/${localStorage.getItem('storeId')}` },
    list: {
      list_display: [
        'name',
        {
          property: 'startTime',
          label: '打卡开始时间',
          component: {
            props: ['data'],
            data() {
              return {
                time: new Date(this.data).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
              }
            },
            render(h) {
              return <span>{this.time}</span>
            }
          }
        },
        {
          property: 'endTime',
          label: '打卡结束时间',
          component: {
            props: ['data'],
            data() {
              return {
                time: new Date(this.data).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })
              }
            },
            render(h) {
              return <span>{this.time}</span>
            }
          }
        }
      ]
    },
    form: {
      fields: [
        'name',
        {
          property: 'startTime',
          field_options: {
            label: '打卡开始时间'
          },
          component: {
            props: ['form', 'property'],
            render(h) {
              return (
                <el-time-picker v-model={this.form[this.property]} value-format={'HH:mm'} format={'HH:mm'}></el-time-picker>
              )
            }
          }
        },
        {
          property: 'endTime',
          field_options: {
            label: '打卡结束时间'
          },
          component: {
            props: ['form', 'property'],
            render(h) {
              return (
                <el-time-picker v-model={this.form[this.property]} value-format={'HH:mm'} format={'HH:mm'}></el-time-picker>
              )
            }
          }
        }
      ]
    }
  }
}

